import request from '@/config/axios'

// 商品采购建议 VO
export interface PurchaseSuggestVO {
  id: number // 商品采购建议id
  productId: string // 商品id
  mainType: number // 是否主商品  1主 2副
  productName: string // 商品名称
  productSuggestions: string // 采购建议
  property: string // 属性
  sku: string // sku码
  orderOccupancyCount: number // 订单占用数
  onHandInventory: number // 实际库存
  inTransitStock: number // 在途库存
  unreviewedInTransitInventory: number // 未审核在途库存
}

// 商品采购建议 API
export const PurchaseSuggestApi = {
  // 查询商品采购建议分页
  getPurchaseSuggestPage: async (params: any) => {
    return await request.get({url: `/admin-api/product/purchase-suggest/page`, params})
  },

  // 查询商品采购建议详情
  getPurchaseSuggest: async (id: number) => {
    return await request.get({url: `/admin-api/product/purchase-suggest/get?id=` + id})
  },

  // 新增商品采购建议
  createPurchaseSuggest: async (data: PurchaseSuggestVO) => {
    return await request.post({url: `/admin-api/product/purchase-suggest/create`, data})
  },

  // 修改商品采购建议
  updatePurchaseSuggest: async (data: PurchaseSuggestVO) => {
    return await request.put({url: `/admin-api/product/purchase-suggest/update`, data})
  },

  // 删除商品采购建议
  deletePurchaseSuggest: async (id: number) => {
    return await request.delete({url: `/admin-api/product/purchase-suggest/delete?id=` + id})
  },

  // 导出商品采购建议 Excel
  exportPurchaseSuggest: async (params) => {
    return await request.download({url: `/admin-api/product/purchase-suggest/export-excel`, params})
  },
  // 查询商品采购建议详情
  getPurchaseLink: async (productIds: string) => {
    return await request.get({url: `/admin-api/product/purchase/getPurchaseLinkList?productIds=${productIds}`})
  },

  addProductLink: async (params: {
      url: string;
      remark: string;
      productId: string;
    }[]) => {
    return await request.post({url: `/admin-api/product/purchase/createList`,data:params})
  }


}

